/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * IntrrFF.java
 *
 * Created on Sep 26, 2011, 7:16:18 PM
 */
package aor2.gui.cpu;

import aor2.cpu.blockcontrol.ConditionSignalSet;
import aor2.cpu.blockcontrol.ControlSignalSet;
import aor2.cpu.blockinterrupt.InternInterruptBoard;
import aor2.cpu.blockinterrupt.InterruptBlock;
import aor2.cpu.blockregisters.InstructionSignal;
import java.awt.Graphics;

/**
 * 
 * @author Yogi
 */
public class IntrrFF extends javax.swing.JPanel {

	private static IntrrFF singleton = null;

	public static IntrrFF getInstance() {
		if (singleton == null)
			singleton = new IntrrFF();
		return singleton;
	}

	private JLabelSet stprcod, ldprcod, clldprcod, KMprcod;

	private void makeSignals() {
		ldprcod = new JLabelSet(false, ldprcod1, ldprcod2, ldprcod3);
		KMprcod = new JLabelSet(false, KMprcod1, KMprcod2, KMprcod3, KMprcod4,
				KMprcod5);
		stprcod = new JLabelSet(false, stprcod1, stprcod2, stprcod3);
		clldprcod = new JLabelSet(false, clldprcod1, clldprcod2);

	}

	/** Creates new form IntrrFF */
	public IntrrFF() {
		initComponents();
		makeSignals();
	}

	@Override
	protected void paintComponent(Graphics g) {
		InternInterruptBoard iib = InterruptBlock.getInstance().getIntInterr();
		ConditionSignalSet condSS = ConditionSignalSet.getInstance();
		ControlSignalSet ctrlSS = ControlSignalSet.getInstance();

		PRINS.setEnabled(condSS.get("PRINM").isActive());
		notPRINS.setEnabled(!PRINS.isEnabled());
		stprins.setEnabled(ctrlSS.get("stprins").isActive());
		clprins.setEnabled(ctrlSS.get("clprins").isActive());

		PRADR.setEnabled(condSS.get("PRADR").isActive());
		notPRADR.setEnabled(!PRADR.isEnabled());
		stpradr.setEnabled(ctrlSS.get("stpradr").isActive());
		clpradr.setEnabled(ctrlSS.get("clpradr").isActive());

		PRCOD.setEnabled(condSS.get("PRCOD").isActive());
		notPRCOD.setEnabled(!PRCOD.isEnabled());
		KMprcod.setEnabled(InstructionSignal.UNKNOWN.isActive());
		stprcod.setEnabled(iib.getStprcod().isActive());
		clearprcod.setEnabled(iib.getClrprcod().isActive());
		clldprcod.setEnabled(!KMprcod.isEnabled() & ldprcod.isEnabled());
		ldprcod.setEnabled(ctrlSS.get("ldprcod").isActive());
		clprcod.setEnabled(ctrlSS.get("clprcod").isActive());

		super.paintComponent(g);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {
		java.awt.GridBagConstraints gridBagConstraints;

		jLayeredPane1 = new javax.swing.JLayeredPane();
		PRINS = new javax.swing.JLabel();
		stprins = new javax.swing.JLabel();
		clprins = new javax.swing.JLabel();
		notPRINS = new javax.swing.JLabel();
		PRCOD = new javax.swing.JLabel();
		notPRCOD = new javax.swing.JLabel();
		IR0 = new javax.swing.JLabel();
		IR0value = new javax.swing.JLabel();
		ldprcod1 = new javax.swing.JLabel();
		ldprcod2 = new javax.swing.JLabel();
		ldprcod3 = new javax.swing.JLabel();
		clprcod = new javax.swing.JLabel();
		KMprcod1 = new javax.swing.JLabel();
		KMprcod2 = new javax.swing.JLabel();
		KMprcod3 = new javax.swing.JLabel();
		KMprcod4 = new javax.swing.JLabel();
		KMprcod5 = new javax.swing.JLabel();
		clldprcod1 = new javax.swing.JLabel();
		clldprcod2 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		stprcod1 = new javax.swing.JLabel();
		stprcod2 = new javax.swing.JLabel();
		stprcod3 = new javax.swing.JLabel();
		clearprcod = new javax.swing.JLabel();
		PRADR = new javax.swing.JLabel();
		notPRADR = new javax.swing.JLabel();
		stpradr = new javax.swing.JLabel();
		clpradr = new javax.swing.JLabel();
		jLabel1 = new javax.swing.JLabel();

		setBackground(new java.awt.Color(255, 255, 255));
		setLayout(new java.awt.GridBagLayout());

		jLayeredPane1.setBackground(new java.awt.Color(255, 255, 255));

		PRINS.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		PRINS.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		PRINS.setEnabled(false);
		PRINS.setBounds(423, 15, 60, 20);
		jLayeredPane1.add(PRINS, javax.swing.JLayeredPane.DEFAULT_LAYER);

		stprins.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		stprins.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		stprins.setEnabled(false);
		stprins.setBounds(278, 17, 34, 14);
		jLayeredPane1.add(stprins, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clprins.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		clprins.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		clprins.setEnabled(false);
		clprins.setBounds(278, 113, 34, 14);
		jLayeredPane1.add(clprins, javax.swing.JLayeredPane.DEFAULT_LAYER);

		notPRINS.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		notPRINS.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		notPRINS.setEnabled(false);
		notPRINS.setBounds(422, 110, 60, 10);
		jLayeredPane1.add(notPRINS, javax.swing.JLayeredPane.DEFAULT_LAYER);

		PRCOD.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		PRCOD.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		PRCOD.setEnabled(false);
		PRCOD.setBounds(434, 271, 60, 10);
		jLayeredPane1.add(PRCOD, javax.swing.JLayeredPane.DEFAULT_LAYER);

		notPRCOD.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		notPRCOD.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		notPRCOD.setEnabled(false);
		notPRCOD.setBounds(434, 364, 60, 10);
		jLayeredPane1.add(notPRCOD, javax.swing.JLayeredPane.DEFAULT_LAYER);

		IR0.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		IR0.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_2pt_z.jpg"))); // NOI18N
		IR0.setBounds(8, 270, 50, 20);
		jLayeredPane1.add(IR0, javax.swing.JLayeredPane.DEFAULT_LAYER);

		IR0value.setText("IR0");
		IR0value.setBounds(10, 260, 30, 15);
		jLayeredPane1.add(IR0value, javax.swing.JLayeredPane.DEFAULT_LAYER);

		ldprcod1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		ldprcod1.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		ldprcod1.setEnabled(false);
		ldprcod1.setBounds(38, 338, 130, 10);
		jLayeredPane1.add(ldprcod1, javax.swing.JLayeredPane.DEFAULT_LAYER);

		ldprcod2.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/vert_1pt_1.jpg"))); // NOI18N
		ldprcod2.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/vert_1pt_0.jpg"))); // NOI18N
		ldprcod2.setEnabled(false);
		ldprcod2.setBounds(124, 255, 20, 88);
		jLayeredPane1.add(ldprcod2, javax.swing.JLayeredPane.DEFAULT_LAYER);

		ldprcod3.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		ldprcod3.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		ldprcod3.setEnabled(false);
		ldprcod3.setBounds(124, 250, 40, 10);
		jLayeredPane1.add(ldprcod3, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clprcod.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		clprcod.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		clprcod.setEnabled(false);
		clprcod.setBounds(66, 368, 150, 20);
		jLayeredPane1.add(clprcod, javax.swing.JLayeredPane.DEFAULT_LAYER);

		KMprcod1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		KMprcod1.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		KMprcod1.setEnabled(false);
		KMprcod1.setBounds(108, 270, 40, 2);
		jLayeredPane1.add(KMprcod1, javax.swing.JLayeredPane.DEFAULT_LAYER);

		KMprcod2.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/vert_1pt_1.jpg"))); // NOI18N
		KMprcod2.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/vert_1pt_0.jpg"))); // NOI18N
		KMprcod2.setEnabled(false);
		KMprcod2.setBounds(147, 241, 10, 31);
		jLayeredPane1.add(KMprcod2, javax.swing.JLayeredPane.DEFAULT_LAYER);

		KMprcod3.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		KMprcod3.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		KMprcod3.setEnabled(false);
		KMprcod3.setBounds(147, 235, 20, 10);
		jLayeredPane1.add(KMprcod3, javax.swing.JLayeredPane.DEFAULT_LAYER);

		KMprcod4.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/vert_1pt_1.jpg"))); // NOI18N
		KMprcod4.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/vert_1pt_0.jpg"))); // NOI18N
		KMprcod4.setEnabled(false);
		KMprcod4.setBounds(130, 270, 34, 60);
		jLayeredPane1.add(KMprcod4, javax.swing.JLayeredPane.DEFAULT_LAYER);

		KMprcod5.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		KMprcod5.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		KMprcod5.setEnabled(false);
		KMprcod5.setBounds(130, 320, 27, 20);
		jLayeredPane1.add(KMprcod5, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clldprcod1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		clldprcod1.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		clldprcod1.setEnabled(false);
		clldprcod1.setBounds(198, 333, 20, 10);
		jLayeredPane1.add(clldprcod1, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clldprcod2.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/vert_1pt_1.jpg"))); // NOI18N
		clldprcod2.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/vert_1pt_0.jpg"))); // NOI18N
		clldprcod2.setEnabled(false);
		clldprcod2.setBounds(217, 337, 20, 30);
		jLayeredPane1.add(clldprcod2, javax.swing.JLayeredPane.DEFAULT_LAYER);

		jLabel4.setBackground(new java.awt.Color(255, 255, 255));
		jLabel4.setText("ldprcod");
		jLabel4.setOpaque(true);
		jLabel4.setBounds(0, 330, 50, 20);
		jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

		stprcod1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		stprcod1.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		stprcod1.setEnabled(false);
		stprcod1.setBounds(194, 243, 90, 14);
		jLayeredPane1.add(stprcod1, javax.swing.JLayeredPane.DEFAULT_LAYER);

		stprcod2.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/vert_1pt_1.jpg"))); // NOI18N
		stprcod2.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/vert_1pt_0.jpg"))); // NOI18N
		stprcod2.setEnabled(false);
		stprcod2.setBounds(282, 250, 34, 30);
		jLayeredPane1.add(stprcod2, javax.swing.JLayeredPane.DEFAULT_LAYER);

		stprcod3.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		stprcod3.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		stprcod3.setEnabled(false);
		stprcod3.setBounds(283, 278, 40, 2);
		jLayeredPane1.add(stprcod3, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clearprcod.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		clearprcod.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		clearprcod.setEnabled(false);
		clearprcod.setBounds(255, 365, 68, 14);
		jLayeredPane1.add(clearprcod, javax.swing.JLayeredPane.DEFAULT_LAYER);

		PRADR.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		PRADR.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		PRADR.setEnabled(false);
		PRADR.setBounds(435, 495, 70, 20);
		jLayeredPane1.add(PRADR, javax.swing.JLayeredPane.DEFAULT_LAYER);

		notPRADR.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		notPRADR.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		notPRADR.setEnabled(false);
		notPRADR.setBounds(434, 590, 70, 10);
		jLayeredPane1.add(notPRADR, javax.swing.JLayeredPane.DEFAULT_LAYER);

		stpradr.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		stpradr.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		stpradr.setEnabled(false);
		stpradr.setBounds(284, 504, 40, 2);
		jLayeredPane1.add(stpradr, javax.swing.JLayeredPane.DEFAULT_LAYER);

		clpradr.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/horiz_1pt_1.jpg"))); // NOI18N
		clpradr.setDisabledIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/aor2/common/resources/horiz_1pt_0.jpg"))); // NOI18N
		clpradr.setEnabled(false);
		clpradr.setBounds(284, 599, 40, 2);
		jLayeredPane1.add(clpradr, javax.swing.JLayeredPane.DEFAULT_LAYER);

		gridBagConstraints = new java.awt.GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 0;
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
		gridBagConstraints.weightx = 1.0;
		gridBagConstraints.weighty = 1.0;
		add(jLayeredPane1, gridBagConstraints);

		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/aor2/common/resources/InterrFF.jpg"))); // NOI18N
		gridBagConstraints = new java.awt.GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 0;
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
		gridBagConstraints.ipadx = 15;
		gridBagConstraints.weightx = 1.0;
		gridBagConstraints.weighty = 1.0;
		add(jLabel1, gridBagConstraints);
	}// </editor-fold>//GEN-END:initComponents
		// Variables declaration - do not modify//GEN-BEGIN:variables

	private javax.swing.JLabel IR0;
	private javax.swing.JLabel IR0value;
	private javax.swing.JLabel KMprcod1;
	private javax.swing.JLabel KMprcod2;
	private javax.swing.JLabel KMprcod3;
	private javax.swing.JLabel KMprcod4;
	private javax.swing.JLabel KMprcod5;
	private javax.swing.JLabel PRADR;
	private javax.swing.JLabel PRCOD;
	private javax.swing.JLabel PRINS;
	private javax.swing.JLabel clearprcod;
	private javax.swing.JLabel clldprcod1;
	private javax.swing.JLabel clldprcod2;
	private javax.swing.JLabel clpradr;
	private javax.swing.JLabel clprcod;
	private javax.swing.JLabel clprins;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLayeredPane jLayeredPane1;
	private javax.swing.JLabel ldprcod1;
	private javax.swing.JLabel ldprcod2;
	private javax.swing.JLabel ldprcod3;
	private javax.swing.JLabel notPRADR;
	private javax.swing.JLabel notPRCOD;
	private javax.swing.JLabel notPRINS;
	private javax.swing.JLabel stpradr;
	private javax.swing.JLabel stprcod1;
	private javax.swing.JLabel stprcod2;
	private javax.swing.JLabel stprcod3;
	private javax.swing.JLabel stprins;
	// End of variables declaration//GEN-END:variables
}
